package com.njtoyo.taxi.admin.mapper.master.mapper;

import cn.hutool.core.lang.Dict;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.library.Const;
import com.njtoyo.taxi.admin.library.common.GeoPoint;
import com.njtoyo.taxi.admin.mapper.master.entity.Taxi;
import com.njtoyo.taxi.admin.rest.export.taxis.TaxisListData;
import com.njtoyo.taxi.admin.rest.presenter.business.driver.DriverTaxiCompanyPresenter;
import com.njtoyo.taxi.admin.rest.presenter.business.taxis.TaxisPresenter;
import com.njtoyo.taxi.admin.rest.wrapper.business.taxis.QueryTaxiActivationCountWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.taxis.TaxiExportWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.taxis.TaxiQueryListWrapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Dell
 * @since 2021-07-08
 */
@Repository
@DS(Const.PRIMARY_DS)
public interface TaxiMapper extends BaseMapper<Taxi> {

    Long getTotalCount(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds);

    Long getUnScrappedTotalCount(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds);

    Long getTotalCount(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds, @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    Long getWorkingTotalCount(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds);

    Long getRidingTotalCount(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds);

    Long getActiveTotalCount(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds);

    //查询车辆所在公司信息
    DriverTaxiCompanyPresenter selectTaxiCompanyId(Long taxiId);

    //车牌号查询车辆信息
    Taxi selectTaxiByPlateNumber(String plateNumber);

    List<Taxi> selectLikeTaxisByPlateNumber(String plateNumber);

    Page<TaxisPresenter> selectListTaxis(TaxiQueryListWrapper wrapper);

    List<TaxisListData> selectTaxisList(TaxiExportWrapper wrapper);

    //查车牌
    Integer selectPlateNumber(String plateNumber);

    // 获取已激活车辆数
    Long getActivationCount(QueryTaxiActivationCountWrapper wrapper);

    List<Map<String, Object>> getWorkingDrives(@Param("cantonIds") List<Long> cantonIds, @Param("companyIds") List<Long> companyIds);

    List<Dict> getNearbyCarByPoint(@Param("geoPoint") GeoPoint geoPoint, @Param("callMode") String callMode);
}
